﻿using System;
using System.Collections;
using System.Collections.Generic;
namespace WPFExcelReport
{
        public class AB55AV95Report : BaseReport
    {
        #region Variable
        byte[] b;
        string strCompany;
        string strExcelFile; 
        #endregion
        public AB55AV95Report()
            : base()
        {
        }
        public AB55AV95Report(Dictionary<string, object> dicParamater)
            : base(dicParamater)
        { 
            strCompany = dicParamater["Company"].ToString().Trim();
            strExcelFile = dicParamater["ExcelFile"].ToString().Trim();
           columns.Add("VKPAUFKRS");
            columns.Add("VKPAUFLFD");
            columns.Add("VKPAUFPOS");
            columns.Add("KDKUNDNA");
            columns.Add("VKPMENGE1");
            columns.Add("STDBATCHNO");
            columns.Add("VKPWUTERM");
            columns.Add("ABPLIEFDAT");
            columns.Add("WBAUFKRS");
            columns.Add("WBAUFLFD");columns.Add("WBAUFPOS");columns.Add("GREEDNO");columns.Add("GWEFTDEN");columns.Add("SPRODUCER");columns.Add("GPRODUCER");columns.Add("SBEAMNO");columns.Add("SBEAMLENG");columns.Add("FFINISH");columns.Add("GLOOMNUM");columns.Add("GSTARTDATE");columns.Add("SENDDATE");columns.Add("SIZEBATCHNO");columns.Add("ABPART");columns.Add("ABPVAR");columns.Add("ABPFARBE");columns.Add("ABPAUFKRS");columns.Add("ABPAUFLFD");columns.Add("ABPAUFPOS");columns.Add("REMARK");columns.Add("GWEFTINFO");
        }
        public void WriteExcelReport(string fileType)
        {
            Queue CellQueue = new Queue();

            string filename = "";
            string sheetName = "";
            string Standard = "AB55AV95";
            strExcelFile = @"HLT\HLTPlanningReport.xls";
            string filePath = @"C:\intex.w\Report\" + strExcelFile;
            exAgent.Open(filePath);
            exAgent.Company = strCompany;
            exAgent.strExcelFile = strExcelFile;
            string filedate = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString();
            filename = @"Planning\织造\WB" + filedate + ".xls";
            sheetName = DateTime.Now.ToShortTimeString().Replace(@":", "");
            exAgent.CreateNewSheet(filename, Standard, sheetName);
            FillInData(columns, dsSource.Tables["ABPOS"]);
            if (exAgent != null)
            {
                exAgent.Save();
                exAgent.Close();
            }
        }
    }

}
